package com.linwen.excise.leetcode;

/**
 * @author : linwen
 * @date : 9:36 下午 2020/10/26
 */
public class _26删除排序数组中的重复项 {
    public static void main(String[] args) {
        int[] arr = new int[]{0,0,1,1,1,2,2,3,3,4,5,5,5,5,6};
        System.out.println(removeDuplicates(arr));

    }
    public static int removeDuplicates(int[] nums) {
        int result = 0;
        for(int i=1;i<nums.length;i++){
            if(nums[i]!=nums[result]){
                result++;
                nums[result] = nums[i];
            }
        }
        return result+1;
    }
}

